package com.hzw.saas.common.config.model;

import java.io.Serializable;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 *
 */
@Data
@Accessors(chain = true)
public class BaseModel implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(type = IdType.INPUT)
    protected String pid;

    /**
     * 创建人id
     */
    @TableField(fill = FieldFill.INSERT)
    protected String creatorId;

    /**
     * 修改人id
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    protected String editorId;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    protected Date createTime;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    protected Date updateTime;

    public void pureBase() {
        this.pureId();
        this.pureCreate();
        this.pureUpdate();
    }

    public void pureTime() {
        this.pureCreate();
        this.pureUpdate();
    }

    public void pureId() {
        this.pid = null;
    }
    
    public void pureCreate() {
        this.createTime = null;
        this.creatorId = null;
    }

    public void pureUpdate() {
        this.updateTime = null;
        this.editorId = null;
    }

}
